package war;

public class Battle {

  private Deck player1;
  private Deck player2;
  private int skip;

  public Battle(Deck player1, Deck player2, int skip) {
    this.player1 = player1;
    this.player2 = player2;
    this.skip = skip;
  }

  public Deck start() {
    int card1 = player1.drawCard();
    int card2 = player2.drawCard();
    if (skip > 0) {
      return new Tie(player1, player2, card1, card2, skip - 1).resolve();
    } else if (card1 > card2) {
      player1.addCards(card1, card2);
      return player1;
    } else if (card1 < card2) {
      player2.addCards(card1, card2);
      return player2;
    } else {
      return new Tie(player1, player2, card1, card2, 3).resolve();
    }
  }

}
